package com.aaa.day1031demo.demo4;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年10月31日10:55
 */
public class Woman implements Runnable{

    private Card card;
    public Woman (Card card){
        this.card=card;
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            if (card.getBalance()>=200) {
                card.setBalance(card.getBalance() - 200);
                System.out.println(Thread.currentThread().getName() + "向卡里取出200，余额：" + card.getBalance());
            }else {
                System.out.println("余额不足,需要存钱");
                i--;
            }
        }
    }
}
